import os

def get_path_size(path1, size, no):
	"""
	获取一个目录下的所有文件和子目录列表和目录大小
	param1:string
	size:float
	no:int
	"""
#获取当前目录文件及文件夹列表
	pathlist = os.listdir(path1)

	for content in  pathlist:
		#拼接路径
		path2 = os.path.join(path1, content)
		print("-->"*no,path2)
		if os.path.isfile(path2):
			size += os.path.getsize(path2)
		else:
			#递归调用
			get_path_size(path2, size, no +1)

	return size
	

#调用函数
# my_path1 = input("请输入要查询的路径")
my_path = "../python"
size = float(0)
#目录子级别
no = 1

get_size = get_path_size(my_path, size, no)
print(round(get_size/(1024*8),3),'M')